#include "stdafx.h"
#include "riftObject.h"
#include "Player.h"
#include "Moving.h"

CPlayer::CPlayer():mpData(NULL)
{
    m_pMove = new CMoving(*this);
}

CPlayer::~CPlayer()
{
    mpData = NULL;
    if (m_pMove)
    {
        delete m_pMove, m_pMove = NULL;
    }
}

bool CPlayer::Update(const sGuid &guid)
{
    mpData = (cUnit*)cGuidMgr::getSingleton().GetPoint(guid, 0);
    if (mpData)
    {
        return true;
    }
    return false;
}

sPos CPlayer::GetPos()
{
    sPos pos;
    if (mpData)
    {
        pos = mpData->GetPos();
    }
    return pos;
}

void CPlayer::ModifyHeading(float angle)
{
    if (mpData)
    {
        mpData->ModifyHeading(angle);
    }
}

DWORD CPlayer::MoveToPos(sPos& s, DWORD type, float err)
{
    return m_pMove->MoveToPos(s, type, err);
}

void CPlayer::EndMoving()
{

}